layui.define(['form','jquery','layer'], function (exports) {
     var $ = layui.jquery;
     var  layer = layui.layer;
     var form = layui.form();

     var edit_roles=function(){};

      edit_roles.prototype.init=function(){
          $.post("./srv/rdo.php?", {tpl:"getDct",name:"部门类型"}, function (d, e) {
           selectShowDataNoH("#depttype",JSON.parse(d),"id","name");
           $("#depttype").prepend("<option value=''>选择角色类型</option>");
           $("#depttype").val($("#stype").val());
           form.render('select');
        });
        $.post("./srv/rdo.php?", {tpl:"getSchool"}, function (d, e) {
           selectShowDataNoH("#mech",JSON.parse(d),"id","sch_name");
           $("#mech").prepend("<option value=''>选择机构</option>");
           $("#mech").val($("#smech").val());
           form.render('select');
        });    
      }

     var index = parent.layer.getFrameIndex(window.name);
     $('#btn_save').click(function(){
        if($("#rolename").val()==""){layer.msg("角色名称不能为空");return false;}
        //document.getElementById("form1").submit();
        parent.layer.close(index);
     });
     
     var editRle=new edit_roles();
     editRle.init();

     exports('edit_role',editRle);
});